1. Field of the Invention
The present invention relates to a device for controlling data storage and/or a data reconstruction and method thereof. The present invention also relates to an image forming apparatus having the device.
2. Description of the Related Art
In an image forming apparatus such as a digital multi function peripheral, a scanned image is read and converted to a digital image, and the digital image is stored as image data in a storage section. In this case, prior to storage the image data to the storage section, many image forming apparatuses perform a data compression (coding) for reducing the data size of image data. At the time of reading and outputting the compressed and stored image data, a decompression (decoding) is performed to decompress the compressed data to original image data and, after that, a printing process is performed.
For a process of compressing a color image, the JPEG compression method is widely used. However, the JPEG compression is an irreversible process. Therefore the picture quality of an image obtained through JPEG compression and decompression deteriorates as compared with its original. When the JPEG compressed image data is further subjected to an image process, the picture quality further decreases. Consequently, to suppress deterioration in picture quality accompanying the image process after the JPEG decompression, a method is employed, of generating additional data corresponding to each pixel at the time of generating image data, storing the generated additional data so as to be associated with image data, and using the additional data for an image process to be performed later.
The additional data is used at the time of performing an image process, for example, to select a preferable parameter of the image process for a pixel. There is the tendency that the information amount of additional data for each pixel increases as a demand for picture quality increases. That is, the additional data is data related to an image and the number of bits per pixel tends to increase. As the number of bits of the additional data increases, the storage capacity necessary for storing the additional data is becoming unignorable. Consequently, by performing the compression on the additional data prior to storage to a storage section, the storage capacity can be suppressed. However, different from image data, a reversible method is necessary for compressing/decompressing additional data. Since the purpose of additional data is to suppress image deterioration after decompression of irreversibly compressed image data, if the original information of the additional data is lost after decompression, the initial purpose cannot be achieved.
As a reversible compressing/decompressing method for multi-value data, a method such as JPEG2000 is known. However, the compression ratio of the reversible compressing/decompressing method is much lower than that of the irreversible compressing/decompressing method. On the other hand, as reversible compressing/decompressing methods for binary data, MH, MR, MMR, and JBIG methods are well known. By the methods, the compression ratio higher than that of the compressing/decompressing methods for multivalued data can be obtained. The circuit scale necessary for realizing the compression/decompression can be smaller and the processing speed can be faster, in addition. However, in the case of processing multivalued additional data, a mechanism for enabling a compression/decompression section to handle target data as binary data is necessary. Regarding this issue, an approach of providing such mechanism has been proposed. For example, to compress/decompress a plurality of jobs by using single compressing/decompressing means, a method of dividing data of each job line by line and performing time-division process is known (refer to, for example, Japanese Patent Laid-Open No. 2004-166187).
As described above, a device or method capable of compressing multivalued additional data at a high compression ratio is demanded.
However, the compression ratio of additional data depends on an image of corresponding image data. It is difficult to predict the compression ratio before the compression. At the time of the compression, a buffer (storage) area for temporarily storing compressed data has to be reserved. The image data compression/decompression in an image forming apparatus is generally performed on the page unit basis. In this case, additional data corresponding to image data is also compressed/decompressed on the page unit basis. On assumption of the worst case, the size of the buffer area to be reserved for the compression becomes equal to that of original additional data in the case where compression of additional data is not performed at all.
It is however not preferable to occupy an extra memory area only because the compression ratio cannot be predicated. It is empirically known that it is rare that the size of a compressed image becomes the same as that of the original image in the binary image data reversible compression/decompression. In particular, when image data of an original image has sufficiently high resolution, it is substantially impossible that bits of neighboring pixels change in all of the area. Therefore, when binary image data is reversibly compressed, in most of the cases, the size of resultant data becomes smaller than that of original data. Since the additional data expresses the attributes of pixels, a similar result is expected.
If a worst-case value of the compression ratio can be predicted even by empirically, it is sufficient to reserve a buffer area based on the predicted value, thereby saving the memory capacity. Even if the compression ratio as a result of the compression does not reach the predicted value, it is sufficient to reserve an additional storage area at that time. In this case, because a buffer area larger than that in the normal case is assigned for the process of compressing the page, the buffer reservation for the following page may take a certain time. The tradeoff between buffer capacity and processing time is allowable if the frequency is in the permissible range of the user. It is more appropriate than a method of always reserving an extra memory area that is hardly used and is charging the user for the cost.